package com.lhkj.ct.meta.modules.scheduling.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lhkj.ct.meta.modules.scheduling.model.dto.ScheduleSearch;
import com.lhkj.ct.meta.modules.scheduling.model.dto.SchedulingDoctor;
import com.lhkj.ct.meta.modules.scheduling.model.dto.SchedulingTime;
import com.lhkj.ct.meta.modules.scheduling.model.entity.TblScheduling;
import com.lhkj.ct.meta.modules.scheduling.model.vo.ScheduleMonthVo;
import com.lhkj.ct.meta.modules.scheduling.model.vo.SchedulingDateVo;
import com.lhkj.ct.meta.modules.scheduling.model.vo.SchedulingDoctorVo;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.Collection;
import java.util.List;
import java.util.Set;

/**
 * <p>
 * 排班记录 Mapper 接口
 * </p>
 *
 * @author jobob
 * @since 2023-10-27
 */
public interface SchedulingMapper extends BaseMapper<TblScheduling> {

    /**
     * 排班管理 - 日历列表
     */
    @InterceptorIgnore
    List<ScheduleMonthVo> selectAllByMonth(@Param("search")ScheduleSearch search);

    /**
     * 排班管理 - 查看某天排班详情
     */
    List<TblScheduling> selectAllByDate(@Param("search") ScheduleSearch search);

    /***
     * 新增排班 - 查询有重复时间段的数据
     */
    Set<TblScheduling> searchRepeat(@Param("doctors") List<SchedulingDoctor> doctors,
                                    @Param("dates") List<LocalDate> dates,
                                    @Param("times") List<SchedulingTime> times);

    Long countReducedNum(@Param("sDate") LocalDate sDate);

    List<TblScheduling> getByIds(@Param("ids")Collection<?> ids);

    /**
     * 预约 - 日期列表
     */
    List<SchedulingDateVo> selectScheDates(@Param("search") ScheduleSearch search);

    /**
     * 预约 - 医生列表
     */
    List<SchedulingDoctorVo> selectScheDoctor(@Param("search") ScheduleSearch search);

    /**
     * 预约-排班时间列表
     */
    List<TblScheduling> selectScheTimes(@Param("search") ScheduleSearch search);

    /**
     * 查询排班详情
     */
    TblScheduling selectSchedulingById(@Param("schId") String schId);
}
